package com.yyr.callmessage.core.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;

public class RandomUtil {

    public static List<String> getRandomNumList(int nums,int start,int end){
        List<String> list = new ArrayList();
        Random r = new Random();
        while(list.size() != nums){
            int num = r.nextInt(end-start) + start;
            if(!list.contains(num+"")){
                list.add(num+"");
            }
        }

        return list;
    }

    /**
     * 生成随机token
     * @param id
     * @return
     */
    public static String getToken(Long id) {
        String token = UUID.randomUUID().toString().replaceAll("-","");
        token = token + "-" + id.toString();
        return token;
    }
}
